<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<h1>要求：页面上3个链接，淘宝、京东、拼多多</h1>
		<h3>使用js访问a标签的href链接，文字内容</h3>
		
		<div>
			<a href="http://www.taobao.com" target="_blank">淘宝</a>
			<a href="http://www.jd.com" target="_blank">京东</a>
			<a href="https://www.pinduoduo.com/" target="_blank">拼多多</a>
		</div>
		
		<script>
			//获取a标签
			//方式一：tagName获取对象和属性值
			//element元素,页面每个内容就成为元素
			
			//获取a标签对象
			console.log(document.getElementsByTagName("a"));
			//获取标签的值，href属性,innerText属性
			//document.getElementsByTagName("a")[0].innerText="abc" //改值
			
			console.log(document.getElementsByTagName("a")[0].href);
			console.log(document.getElementsByTagName("a")[0].innerText);
			console.log(document.getElementsByTagName("a")[1].href);
			console.log(document.getElementsByTagName("a")[1].innerText);
			console.log(document.getElementsByTagName("a")[2].href);
			console.log(document.getElementsByTagName("a")[2].innerText);
		</script>
	</body>
</html>
